PushRange Method (T[])

Task Parallel System.Threading

Inserts multiple objects at the top of the ConcurrentStack<(Of <(T>)>) atomically.

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Sub PushRange ( _
	items As T() _
)
C#
public void PushRange(
	T[] items
)

Parameters

items
Type: array< T >[]()[]
The objects to push onto the ConcurrentStack<(Of <(T>)>).

Remarks

When adding multiple items to the stack, using PushRange is a more efficient mechanism than using Push(T) one item at a time. Additionally, PushRange guarantees that all of the elements will be added atomically, meaning that no other threads will be able to inject elements between the elements being pushed. Items at lower indices in the items array will be pushed before items at higher indices.

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionitems is a null reference (Nothing in Visual Basic).

See Also